package sbc.ms;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;

import sbc.model.Platine;
import sbc.model.Sensor;
import sbc.corso.*;

public class TestConsumerProducer {

	public static void main(String[] args) {
		
		Logger.getLogger("org.xvsm.client").setLevel(Level.FATAL);
		if (args.length != 1) {
			System.out.println("URL needed!");
			System.out.println("Usage: java -cp <classpath> sbc.ms.TestConsumerProducer http://localhost:8080/xvsm/xvsm");
			System.exit(1);
		}
		
		
		/*
		 * start consumer
		 * notification will be fired, when something is produced
		 */
		//Consumer c = new Consumer(args[0], new SBCNotificationListener());
		//c.start();
		
		
		/*
		 * produce a Platine 
		 */
		Platine myPlatine = new Platine();
		myPlatine.setMyId("A234xdfk1");
		
		Producer p1 = new Producer(args[0], myPlatine);
		p1.start();
		
		Platine myPlatine1= new Platine();
		myPlatine1.setMyId("000000");
		
		Producer p3 = new Producer(args[0], myPlatine1);
		p3.start();

		/*
		 * produce a Sensor 
		 */
		Sensor mySensor = new Sensor();
		mySensor.setMyId("Sx3322G");
		
		Producer p2 = new Producer(args[0], mySensor);
		p2.start();
		
		//Bridge mybridge = new Bridge(args[0]);
		//mybridge.start();
	}
}
